<template>
  <div class="notification-detail-page">
    <div class="header d-flex align-items-center">
      <router-link to="/notification" class="text-dark">
        <i class="bi bi-chevron-left fs-4"></i>
      </router-link>
      <h5 class="mb-0 mx-auto">消息详情</h5>
    </div>

    <div class="detail-container" v-if="message">
      <div class="message-header">
        <h4 class="message-title">{{ message.title }}</h4>
        <div class="message-meta">
          <span class="time">{{ message.time }}</span>
        </div>
      </div>
      <div class="message-body"  v-html="message.content"></div>
    </div>
  </div>
</template>

<script>
import http from '@/router/http';
export default {
  name: 'NotificationDetailView',
  data() {
    return {
      message: null,
      informId: null
    };
  },
  created() {
    this.informId = this.$route.params.id;
    this.fetchMessage();
  },
  methods: {
    async fetchMessage() {
      await http.get(`/student/inform/selectDetailForStudent/${this.informId}`).then(res => {
        if (res.data.code === 1) {
          this.message = {
            id: res.data.response.informId,
            title: res.data.response.informTypeStr,
            content: res.data.response.content,
            time: res.data.response.createTime
          };
        }
      });
    }
  },
};
</script>

<style scoped>
.notification-detail-page {
  background-color: #f0f9f9;
  min-height: 100vh;
}

.header {
  padding: 15px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.detail-container {
  padding: 20px;
  background: white;
  margin: 15px;
  border-radius: 8px;
}

.message-header {
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.message-title {
  color: #333;
  margin-bottom: 10px;
}

.message-meta {
  color: #666;
  font-size: 0.9rem;
}

.message-body {
  color: #333;
  line-height: 1.6;
  white-space: pre-line;
}
</style> 